/**
* 选择组织结构
*/
function ev_selectOrg(orgObj,orgCode,orgName,orgType){
    currentlyObj=orgObj;
    showModalDialog("/PubUI/PUI_OrgSelect.jsp?workGroup=Y&flgSysUser=Y",window,'dialogHeight:212px;dialogWidth:550px;status=off');
    currentlyObj=null;
    var orgCodeStr = "";
    var orgNameStr = "";
    var orgTypeStr = "";
    for(var i=0;i<orgObj.getOrgCount();i++){
      var tmporg=orgObj.fndbyIndex(i);
      if(tmporg!=null){
        if(orgNameStr==""){
          orgCodeStr = tmporg.getOrgCode();
          orgNameStr = tmporg.getOrgName();
          orgTypeStr = tmporg.getOrgType();
        }
        else{
          orgCodeStr = orgCodeStr +","+ tmporg.getOrgCode();
          orgNameStr = orgNameStr+","+tmporg.getOrgName();
          orgTypeStr = orgTypeStr + "," +tmporg.getOrgType();
        }
      }
    }

    if (document.all(orgCode) != null)
      document.all(orgCode).value = orgCodeStr;
    if (document.all(orgName) != null)
      document.all(orgName).value = orgNameStr;
    if (document.all(orgType) != null)
      document.all(orgType).value = orgTypeStr;
  }

/**
* 选择组织结构for DIV
*/

  function ev_selectOrgByDiv(orgObj,orgCode,orgName,orgType){
    currentlyObj=orgObj;
    showModalDialog("/PubUI/PUI_OrgSelect.jsp?workGroup=Y&flgSysUser=Y",window,'dialogHeight:212px;dialogWidth:550px;status=off');
    currentlyObj=null;

    var orgCodeStr = "";
    var orgNameStr = "";
    var orgTypeStr = "";
    for(var i=0;i<orgObj.getOrgCount();i++){
      var tmporg=orgObj.fndbyIndex(i);
      if(tmporg!=null){
        if(orgNameStr==""){
          orgCodeStr = tmporg.getOrgCode();
          orgNameStr = tmporg.getOrgName();
          orgTypeStr = tmporg.getOrgType();
        }
        else{
          orgCodeStr = orgCodeStr +","+ tmporg.getOrgCode();
          orgNameStr = orgNameStr+","+tmporg.getOrgName();
          orgTypeStr = orgTypeStr + "," +tmporg.getOrgType();
        }
      }
    }
    if (document.all(orgCode) != null)
      document.all(orgCode).value = orgCodeStr;
    if (document.all(orgName) != null)
      document.all(orgName).value = orgNameStr;
    if (document.all(orgType) != null)
      document.all(orgType).value = orgTypeStr;
  }

/**
* 会议室选择
*/

function ev_findRoomName(roomid,roomname,device,title,orenRoomID)
{
    var rval = window.showModalDialog("/AppUI/Hygl/AppUI_MeetRoomChild.jsp?action=selectone&orenRoomID="+orenRoomID,window,'dialogHeight:535px;dialogWidth:750px;status=off');
    if (rval != null)
    {
        if(roomid != null && document.all(roomid) != null && rval.infoid != null)
            document.all(roomid).value = rval.infoid;
        if(roomname != null && document.all(roomname) != null && rval.infoname != null )
             document.all(roomname).value = rval.infoname;
        if(device != null && document.all(device) != null && rval.other1 != null )
             document.all(device).value = rval.other1;
    }
}


/**
* 批注显示
*/

  function ev_showPostMessage(resID)
  {
    url ="/AppUI/AppUI_PostilMessager.jsp?resourceID="+resID;
    var arg = new Object;
    arg.title = "查看批注";
    window.showModalDialog(url,arg,'font-size:9pt;dialogWidth:720px;dialogHeight:480px;status:no;scroll=yes;');
  }

/**
* 选择日期
*/
function ev_setdate(ename)
{
   var selectdate = window.showModalDialog('/js/common/Calendar.htm',window,'dialogHeight:200px;dialogWidth:210px;status=off');
   if (selectdate != "" && selectdate !=undefined) {
	document.all(ename).value=selectdate;
   }
}

/**
* 选择日期时间
*/
function ev_setdatetime(ename){

   var selectdate = window.showModalDialog('/js/common/dailyTime.htm',window,'dialogHeight:240px;dialogWidth:210px;status=off');
   if (selectdate != "" && selectdate !=undefined) document.all(ename).value=selectdate;
}


/**
* 设置当前日期
*/
function ev_today(ename){
  var today = new Date();
   month = today.getMonth()+1;
   day = today.getDate();
  if (month<10) {
     month ='0'+month;
  }
  if (day<10)
     day = '0'+day;
  var selectdate = today.getYear() + '-' + month + '-' + day;
  document.all(ename).value = selectdate;
}

